<include file="public/header" />
<style>
    .cla{
        text-align: left;padding-left: 0px;margin-left: 0px;
        width: 100%;
    }

</style>

<body style="margin-top: 20px;">
<form class="layui-form" action="{:url('Repair/editRepair')}">
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">搜索选择品牌</label>
            <div class="layui-input-inline">
                <select name="cate_id" lay-verify="required" lay-search="">
                    <option value="">直接选择或搜索选择</option>
                    <foreach name="category" item="vo">

                     <empty name="vo.child">
                         <option value="{$vo.id}" {vo.id == $info.cate_id ?'selected':'' }>{$vo.name}</option>
                         <else/>
                         <optgroup label="{$vo.name}">
                             <foreach name="$vo.child" item="vv">
                                 <option value="{$vv.id}" {vv.id == $info.cate_id ?'selected':'' }>{$vv.name}</option>
                             </foreach>
                         </optgroup>
                         </empty>

                    </foreach>
                </select>
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">标题:</label>
        <div class="layui-input-block">
            <input type="text" name="name" value="" style="width: 500px;" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">唯一识别号(车牌):</label>
        <div class="layui-input-block">
            <input type="text" name="unique_number" value="" style="width: 500px;" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">客户名称:</label>
        <div class="layui-input-inline" style="width: 100px;">
            <input type="text" name="username" value="" style="width: 500px;" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">客户电话:</label>
        <div class="layui-input-inline" style="width: 100px;">
            <input type="text" name="mobile" value="" style="width: 500px;" autocomplete="off" class="layui-input">
        </div>
    </div>
<!--        <div class="layui-form-item">-->
<!--            <label class="layui-form-label">消费凭证：</label>-->
<!--            <div class="layui-input-inline">-->
<!--                <input type="hidden" name="expend_voucher" lay-verify="required" id="inputimgurl" placeholder="图片地址" value="" class="layui-input">-->
<!--            </div>-->
<!--            <div class="layui-input-inline">-->
<!--                <div class="layui-upload-list" style="margin:0">-->
<!--                    <img width="320" height="240"  id="srcimgurl" src="" class="layui-upload-img" />-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="layui-input-inline layui-btn-container" style="width: auto;">-->
<!--                <a class="layui-btn layui-btn-primary" id="editimg">修改图片</a >-->
<!--            </div>-->
<!--            <div class="layui-form-mid layui-word-aux"></div>-->
<!--        </div>-->
    <div class="layui-form-item">

        <label class="layui-form-label">消费凭证：</label>
        <input type="hidden" name="expend_voucher" class="multiple_show_img" value="">
        <div class="layui-upload">
            <button type="button" class="layui-btn" id="multiple_img_upload"><i class="layui-icon"></i>上传:</button>
            <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                预览：
                <div class="layui-upload-list" id="div-slide_show"></div>
            </blockquote>
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label">客户底单：</label>
        <input type="hidden" name="thubms" class="multiple_show_img1" value="">
        <div class="layui-upload">
            <button type="button" class="layui-btn" id="multiple_img_upload1"><i class="layui-icon"></i>上传:</button>
            <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                预览：
                <div class="layui-upload-list" id="div-slide_show1"></div>
            </blockquote>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">预计完成时间:</label>
        <div class="layui-input-inline" style="width: 100px;">
            <input type="text" name="repair_time" value=""  autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">完成通知延迟:/天数</label>
        <div class="layui-input-inline" style="width: 100px;">
            <input type="text" name="delay_notify" value=""  autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">登记人:</label>
        <div class="layui-input-inline" style="width: 100px;">
            <input type="text" name="registrant" value="" style="width: 500px;" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">价格:</label>
        <div class="layui-input-block">
            <input type="number" name="price" value="{$info.price}" style="width: 180px;" autocomplete="off" placeholder="请输入价格" class="layui-input">
            <label class="layui-form-label cla" > </label>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">折扣价格:</label>
        <div class="layui-input-block">
            <input type="number" name="discount" value="{$info.price}" style="width: 180px;" autocomplete="off" placeholder="请输入价格" class="layui-input">
            <label class="layui-form-label cla" > </label>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">参与项目员工</label>
        <div class="layui-input-block">
            <foreach name="staff" key="key" item="item">
                <input type="checkbox" name="staff_id[]" value="{$item.id}" title="{$item.name}" {$item==$info['status']? 'checked':""}>
            </foreach>

        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">状态</label>
        <div class="layui-input-block">
            <foreach name="status" key="key" item="item">
                <input type="radio" name="status" value="{$key}" title="{$item}" {$item==$info['status']? 'checked':""}>
            </foreach>

        </div>
    </div>
    <div class="layui-form-item" >
        <div class="layui-input-block">
            <input type="hidden" name="id" value="{$info.id}">
            <button type="button"  class="layui-btn" lay-submit=""  lay-filter="addEdit">保存</button>
        </div>
    </div>
</form>
<blockquote class="layui-elem-quote layui-quote-nm">

    <br>
</blockquote>
</body>
<script src="/static/uploadmore/upload.js" type="text/javascript"></script>
<script>


    var multiple_images = [];

    //单击图片删除图片 【注册全局函数】

    function delMultipleImgs(this_img){

        //获取下标

        var subscript=$("#div-slide_show img").index(this_img);

        //删除图片

        this_img.remove();

        //删除数组

        multiple_images.splice(subscript, 1);

        //重新排序

        multiple_images.sort();

        $('.multiple_show_img').val(multiple_images);

        //返回

        return ;

    }

    var multiple_images1 = [];

    //单击图片删除图片 【注册全局函数】

    function delMultipleImgs1(this_img){

        //获取下标

        var subscript=$("#div-slide_show1 img").index(this_img);

        //删除图片

        this_img.remove();

        //删除数组

        multiple_images.splice(subscript, 1);

        //重新排序

        multiple_images.sort();

        $('.multiple_show_img1').val(multiple_images);

        //返回

        return ;

    }

    layui.config({
        base: "/static/uploadmore/"
    })

    layui.use(['form', 'layedit', 'laydate','jquery','upload'], function(){
        var form = layui.form
            ,layer = layui.layer
            , $ = layui.jquery
            , upload = layui.upload
            ,laydate = layui.laydate
            ,inputTags = layui.inputTags
        var layedit = layui.layedit;
        //拖拽上传
        upload.render({

            elem: '#multiple_img_upload'
            ,url: "{:url('Upload/ajaxUploadFile')}"
            ,multiple: true
            ,exts: 'png|jpeg|jpg|webp' //只允许上传压缩文件
            ,before: function(obj){

                //预读本地文件示例，不支持ie8

                obj.preview(function(index, file, result){

                    $('#div-slide_show').append('<img src="'+ result +'" alt="'+ file.name +'" title="点击删除" class="layui-upload-img" style="width: 100px;height: 100px;" onclick="delMultipleImgs(this)"> ')

                });

            }

            ,done: function(res){

                //如果上传成功

                if (res.code == 200) {

                    //追加图片成功追加文件名至图片容器

                    multiple_images.push(res.data.path);

                    $('.multiple_show_img').val(multiple_images);

                }else {

                    //提示信息

                    layer.msg(res.msg);

                }

            }

        });

        upload.render({

            elem: '#multiple_img_upload1'
            ,url: "{:url('Upload/ajaxUploadFile')}"
            ,multiple: true
            ,exts: 'png|jpeg|jpg|webp' //只允许上传压缩文件
            ,before: function(obj){

                //预读本地文件示例，不支持ie8

                obj.preview(function(index, file, result){

                    $('#div-slide_show1').append('<img src="'+ result +'" alt="'+ file.name +'" title="点击删除" class="layui-upload-img" style="width: 100px;height: 100px;" onclick="delMultipleImgs1(this)"> ')

                });

            }

            ,done: function(res){

                //如果上传成功

                if (res.code == 200) {

                    //追加图片成功追加文件名至图片容器

                    multiple_images.push(res.data.path);

                    $('.multiple_show_img1').val(multiple_images);

                }else {

                    //提示信息

                    layer.msg(res.msg);

                }

            }

        });


        form.on('submit(addEdit)', function(data){
            $.post($('form').attr('action'),data.field,function(data){
                if(data.code == 200){
                    layer.msg(data.msg);
                    xadmin.close();
                    // xadmin.father_reload();
                }else {
                    layer.msg(data.msg);
                }
            });
            return false;
        });

    });

</script>

